package com.cskaoyan.javase.oop3.interface2.exercise4;

/**
 * @description: 运动员案例
 * @author: wuguidong@cskaoyan.onaliyun.com
 **/

/**
 * 教练（Coach）和运动员（Sportsman）案例
 * - 乒乓球（TableTennis）运动员和篮球（basketball）运动员
 * - 乒乓球教练和篮球教练
 * - 为了出国交流，跟乒乓球相关的人员都需要学习英语
 *
 * 抽象类：教练和运动员
 * 普通类：乒乓球运动员，篮球运动员，篮球教练，乒乓球教练
 * 接口：学习英语
 *
 * 大家后面还是比较少设计，初级开发 往往只需要写接口就行
 *
 */
public class Demo2 {
    public static void main(String[] args) {
        //创建一个乒乓球教练对象
        AbstractCoach ac = new TableTennisCoach("张三",48,100000,"乒乓球");
        ac.teach();
    }
}

abstract class AbstractCoach{
    String name;
    int age;
    double salary;
    String teach; //教授的东西

    public abstract void teach();

    //写教练类的有参构造方法

    public AbstractCoach(String name, int age, double salary, String teach) {
        this.name = name;
        this.age = age;
        this.salary = salary;
        this.teach = teach;
    }

    public AbstractCoach() {
    }
}
abstract class Sportsman{
    String name;
    int age;
    double salary;
    String sport;//运动项目

    public abstract void play();
}
interface Learning{
    void learningEnglish();
}
//乒乓球运动员类
class TableTennisSportsman extends Sportsman implements Learning{

    @Override
    public void play() {
        System.out.println("我打乒乓球");
    }

    @Override
    public void learningEnglish() {
        System.out.println("为了出国交流，学习英语");
    }
}
//篮球运动员类
class BasketballSportsman extends Sportsman{

    @Override
    public void play() {
        System.out.println("我打篮球");
    }
}
//篮球教练类
class BasketballCoach extends AbstractCoach{
    @Override
    public void teach() {
        System.out.println("我教篮球运动");
    }
}
//乒乓球教练类
class TableTennisCoach extends AbstractCoach{
    @Override
    public void teach() {
        System.out.println("我教乒乓球运动");
    }
    public TableTennisCoach() {
    }

    public TableTennisCoach(String name, int age, double salary, String teach) {
        super(name, age, salary, teach);
    }
}